package com.tom.architect.party4.day33.simple2;

import android.os.Bundle;
import android.widget.Toast;

import com.tom.architect.R;

import androidx.appcompat.app.AppCompatActivity;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;


/**
 * 2.data是不同的类型。成功data是对象；不成功data是个String
 * 3.baseUrl。不同的baseUrl构建不同的Retrofit？
 */
public class MainActivity3302 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main33);

        RetrofitClient.getServiceApi()
                .userLogin("Tom", "123456")
                .enqueue(new HttpCallback<UserInfo>() {
                    @Override
                    protected void onSucceed(UserInfo result) {
                        // 登录成功
                        Toast.makeText(MainActivity3302.this, "登录成功 " + result.toString(), Toast.LENGTH_SHORT).show();

                    }

                    @Override
                    protected void onError(String code, String msg) {
                        // 失败
                        Toast.makeText(MainActivity3302.this, msg, Toast.LENGTH_SHORT).show();
                    }
                });

    }


}